# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Maintainer: T.J. Townsend <blakkheim@archlinux.org>
# Contributor: Jaroslav Lichtblau <dragonlord@aur.archlinux.org>
# Contributor: Jens Adam <jra@byte.cx>
# Contributor: Abel Stern <abel.stern AT gmail.com>
# Contributor: Anton Bazhenov <anton.bazhenov at gmail>

pkgname=byacc
pkgver=20230219
pkgrel=1
pkgdesc='Berkeley reimplementation of the Unix parser generator Yacc'
url='https://invisible-island.net/byacc/'
arch=('loong64' 'x86_64')
license=('custom')
depends=('glibc')
replaces=('byacc-noconflict')
source=(https://invisible-mirror.net/archives/${pkgname}/${pkgname}-${pkgver}.tgz{,.asc})
sha512sums=('55fb9abc82afffb68a2167eb3f6211b1c2c91dda4f3b6004c01c46b2022bbec4ed8f793cfb86094eaa66decbd40d9e6f06af5b0da9d72f30ca0676aa38eb2d5e'
            'SKIP')
validpgpkeys=('19882D92DDA4C400C22C0D56CC2AF4472167BE03') # Thomas Dickey <dickey@his.com>

build() {
  cd ${pkgname}-${pkgver}
  sed -n '/is distributed/,/distributed freely/p' README > LICENSE
  ./configure \
    --prefix=/usr \
    --mandir=/usr/share/man \
    --program-transform=s,^,b, \
    --enable-btyacc
  make
}

package() {
  cd ${pkgname}-${pkgver}
  make DESTDIR="${pkgdir}" install
  install -Dm 644 README -t "${pkgdir}/usr/share/doc/${pkgname}"
  install -Dm 644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
}

# vim:set ts=2 sw=2 et:
